'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  // const { router, controller, swagger } = app;
  router.get('/', controller.home.index);
  router.get('/eureka/:id', controller.home.eureka);
  // swagger.get('/', {});
  /*
    swagger.get('/', {
    tags: [
      'Index',
    ],
    summary: '首页',
    description: '',
    parameters: [
      {
        in: 'body',
        name: 'body',
        description: '首页信息',
        schema: {

        },
      },
    ],
    responses: {
      200: {
        description: 'SUCCEED',
        schema: {
          type: 'object',
          properties: {
            status: {
              type: 'string',
              description: 'status',
            },
            data: {
              type: 'object',
              description: 'data',
              properties: {
                token: {
                  type: 'string',
                  description: 'token',
                },
              },
            },
          },
        },
      },
    },
  });
  */

  router.post('/fetch', controller.home.fetch);
  router.post('/form', controller.users.form);

  router.get('/v1/users', controller.users.index);
  router.get('/v1/users/:id', controller.users.showById);
  router.get('/v1/users/:name', controller.users.showByName);
  router.put('/v1/users', controller.users.update);
  router.del('/v1/users/:id', controller.users.deleteById);
  router.post('/v1/users', controller.users.create);
  // router.resources('users', '/users', controller.users);
};
